package com.ultron.core.service.impl.sysFile;

import com.ultron.core.entity.base.BaseBatchBO;
import com.ultron.core.entity.sysFile.bo.SysFileCreateBO;
import com.ultron.core.feign.api.ISysFileFeignClient;
import com.ultron.common.entity.system.Result;
import com.ultron.common.entity.system.ResultEnum;
import com.ultron.common.exception.ServiceException;
import com.ultron.core.service.sysFile.ISysFileFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * 标题：SysFileRelClientServiceImpl
 * 说明：
 * 时间：2023/10/16
 * 作者：admin
 */
@Service
public class SysFileFeignServiceImpl implements ISysFileFeignService {

    @Autowired
    private ISysFileFeignClient iSysFileFeignClient;


    @Override
    public List<Long> createAndBuildRel(BaseBatchBO<SysFileCreateBO> req) {
        List<Long> rsp = new ArrayList<>();
        Result<List<Long>> result = iSysFileFeignClient.createAndBuildRel(req);
        if(result.isSuccess()){
            rsp = result.getData();
        }else {
            throw new ServiceException(ResultEnum.FAILURE, result.getMsg());
        }
        return rsp;
    }
}
